package com.wangc.report.utils;


import java.io.BufferedWriter;
import java.io.FileWriter;

/**
 * java掉用excle示例
 */
public class ExportFile {

    public static void main(String[] args) {
        try {
            new ExportFile().export();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void export() throws Exception {
        String filePath = "init//test10_old.txt";
        BufferedWriter bw = null;
        StringBuffer sb = new StringBuffer();
        bw = new BufferedWriter(new FileWriter(filePath));
        int i = 0;
        for (i = 0; i < 1000000; i++) {
            if (i == 999999) {
                sb.append(String.valueOf(i) + "|保理融资短期贷款|22906644.00|22906644.00|");
            } else {
                sb.append(String.valueOf(i) + "|保理融资短期贷款|22906644.00|22906644.00|\n");
            }
            if (i == 10000) {
                bw.write(sb.toString());
                bw.flush();
                sb.delete(0, sb.length());
            }

        }
        if (i != 10000) {
            bw.write(sb.toString());
            bw.flush();
            sb.delete(0, sb.length());
        }

        bw.close();
    }
}
